<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%
	String cpath = request.getContextPath();
	request.setAttribute("cpath", cpath);
%>
<link href="${cpath}/admin/images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
-->
</style>
<script>
function checkAll() {
	var chooseArray=document.getElementsByName("choose");
	var choosepare=document.getElementById("choosepare");
	if(choosepare.checked==true){
		for(var i=0;i<chooseArray.length;i++){
			chooseArray[i].checked=true;
		}
	}else{
		for(var i=0;i<chooseArray.length;i++){
			chooseArray[i].checked=false;
		}
	}
}

function deleteMore(){
	var chooseArray=document.getElementsByName("choose");
	var n=0;
	var ids="";
	for(var i=0;i<chooseArray.length;i++){
		if(chooseArray[i].checked==true){
			n++;
			ids+=chooseArray[i].value+",";
		}
	}
	if(n==0){
		alert("请选择要删除的记录！");
		return false;
	}else{
		if(confirm('确认删除吗？')){
			ids=ids.substring(0,ids.length-1);
			location.href="userMagdeleteAction?ids="+ids;
		}
	}
}
</script>	
  <body>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="17" valign="top" background="${cpath}/admin/images/mail_leftbg.gif">
      	<img src="${cpath}/admin/images/left-top-right.gif" width="17" height="29" />
      </td>
      <td valign="top" background="${cpath}/admin/images/content-bg.gif">
      	<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        	<tr>
          		<td height="31"><div class="titlebt">用户管理</div></td>
        	</tr>
      	</table>
      </td>
      <td width="16" valign="top" background="${cpath}/admin/images/mail_rightbg.gif">
      	<img src="${cpath}/admin/images/nav-right-bg.gif" width="16" height="29" />
      </td>
    </tr>
    
    <tr>
      <td valign="middle" background="${cpath}/admin/images/mail_leftbg.gif">&nbsp;</td>
      <td style="margin-top: 30px;text-align: center" bgcolor="#F7F8F9">
      		<table width="95%" border="0" cellspacing="0" cellpadding="0" class="line_table">
              <tr>
                <td align="center" height="30" width="10%" class="left_ts">
                	<input type="checkbox" id="choosepare" onClick="checkAll();">
                </td>
                <td align="center" width="8%" class="left_ts">序号</td>
              	<td align="center" width="20%" class="left_ts">账号</td>
              	<td align="center" width="22%" class="left_ts">E-mail</td>
              	<td align="center" width="10%" class="left_ts">是否禁用</td>
              	<td align="center" width="10%" class="left_ts">详情</td>
              	<td align="center" width="10%" class="left_ts">修改</td>
				<td align="center" width="10%" class="left_ts">删除</td>
              </tr> 
              <c:forEach items="${ResultList}" var="item" varStatus="vs">						
				<c:choose>
					<c:when test="${vs.count % 2 ==1}">
						<tr bgcolor="#f2f2f2">
					</c:when>
					<c:otherwise>
						<tr>
					</c:otherwise>
				</c:choose>	
					<td align="center" height="30" class="left_txt2">
						<input type="checkbox" name ="choose" value="${item.id}" >
					</td>
					<td align="center" class="left_txt2">${vs.count}</td>
                	<td align="center" class="left_txt2">${item.name}</td>
                	<td align="center" class="left_txt2">${item.email}</td>
                	<td align="center" class="left_txt2">
                		<c:if test="${item.isdisable==0}">禁用</c:if>
                		<c:if test="${item.isdisable==1}">启用</c:if>
                	</td>
                	<td align="center">	
						<a href='<c:url value="userMaguserModifyAction">
    						 <c:param name="ID" value="${item.id}" />
    						 <c:param name="act" value="view" />
    					 	</c:url>' >
    					 	<img src="<c:out value='${cpath}'/>/admin/images/view.gif"
								width="16" height="16" border="0" alt="详情">
    					</a>
					</td>
					<td align="center">
						<a href='<c:url value="userMaguserModifyAction">
    					 	<c:param name="ID" value="${item.id}" />
    						 <c:param name="act" value="modify" />
    					 	</c:url>'>
    					 	<img src="<c:out value='${cpath}'/>/admin/images/modify.gif"
								width="16" height="16" border="0" alt="修改">
    					</a>	
					</td>
					<td align="center">
						<a href='<c:url value="userMagdeleteAction">
    					 	<c:param name="ids" value="${item.id}" />
    					 	</c:url>' onclick="return confirm('确认删除吗？');">
    					 	<img src="<c:out value='${cpath}'/>/admin/images/del.gif"
								width="16" height="16" border="0" alt="删除">
    					</a>
					</td>
              </c:forEach>
      		</table>
      		<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="20%" height="30" align="right"><input type="button"  value="新建" onclick="location.href='${cpath}/admin/userMag/userView.jsp'"/></td>
                <td width="20%" height="30" align="right"><input type="button"  value="删除" onclick="deleteMore();"/></td>
                <td>&nbsp;</td>
              </tr>
      		</table>
      </td>
      
      <td background="${cpath}/admin/images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    
    
    <tr>
      <td valign="bottom" background="${cpath}/admin/images/mail_leftbg.gif"><img src="${cpath}/admin/images/buttom_left2.gif" width="17" height="17" /></td>
      <td background="${cpath}/admin/images/buttom_bgs.gif"><img src="${cpath}/admin/images/buttom_bgs.gif" width="17" height="17"></td>
      <td valign="bottom" background="${cpath}/admin/images/mail_rightbg.gif"><img src="${cpath}/admin/images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
  </table>
</body>